<template>
	<div>
		<!-- 运营商管理员 -->
		<admin v-if="use == 0"></admin>
		<!-- 加盟商管理员 -->
		<franchisee v-if="use == 1"></franchisee>
		<!-- 最高管理员 -->
		<manger v-if="use == 2"></manger>
	</div>
</template>

<script>
import admin from '@/components/layout-template/admin'
import franchisee from '@/components/layout-template/franchisee'
import manger from '@/components/layout-template/manger'

export default {
	components: {
		admin,
		franchisee,
		manger
	},
	data() {
		return {
			use: null
		}
	},
	created() {
		if (process.client) {
			if (localStorage.getItem("lifeData")) { //检查是否存在登录token
				this.$store.dispatch('setInitData', localStorage.getItem("lifeData"))
				// this.$store.dispatch('signalrConnection')
				
				this.$store.dispatch('getUserInfo').then((res) => {
					// console.log('admin.vue-获取用户信息',res)
					if(localStorage.getItem('UserType') == 5){
						localStorage.setItem('useTemplate',2)
					}else{
						if(res.bindinfo?.operator.ismanager == true){
							localStorage.setItem('useTemplate',0)
						}else{
							localStorage.setItem('useTemplate',1)
						}
					}
				})
			}else{
				this.$router.push({
					path: '/login?status=2'
				})
			}
		}
	},
	mounted() {
		this.use = localStorage.getItem('useTemplate')
		this.$store.dispatch('signalrConnection')
	},
	methods: {
		
	}
}
</script>

<style lang="scss" scoped>

</style>
